# Contributor: Rasmus Thomsen <oss@cogitri.dev>
# Maintainer: Rasmus Thomsen <oss@cogitri.dev>
pkgname=alpinelinux-appstream-data
pkgver=20200728
pkgrel=0
pkgdesc="Alpine Linux appstream data"
url="https://alpinelinux.org"
arch="x86_64 aarch64" # Only arches metadata is generated for
license="GPL-3.0-or-later"
options="!check" # Only XML data and icons - no tests
# Make sure to replace edge with the appropriate branch when upgrading branches
source="
	$pkgname-icons-main-64x64-$pkgver-edge.tar.gz::https://appstream.alpinelinux.org/$pkgver/data/edge/main/icons-64x64.tar.gz
	$pkgname-icons-main-128x128-$pkgver-edge.tar.gz::https://appstream.alpinelinux.org/$pkgver/data/edge/main/icons-128x128.tar.gz
	$pkgname-repo-main-x86_64-$pkgver-edge.xml.gz::https://appstream.alpinelinux.org/$pkgver/data/edge/main/Components-x86_64.xml.gz
	$pkgname-repo-main-aarch64-$pkgver-edge.xml.gz::https://appstream.alpinelinux.org/$pkgver/data/edge/main/Components-aarch64.xml.gz
	$pkgname-icons-community-64x64-$pkgver-edge.tar.gz::https://appstream.alpinelinux.org/$pkgver/data/edge/community/icons-64x64.tar.gz
	$pkgname-icons-community-128x128-$pkgver-edge.tar.gz::https://appstream.alpinelinux.org/$pkgver/data/edge/community/icons-128x128.tar.gz
	$pkgname-repo-community-x86_64-$pkgver-edge.xml.gz::https://appstream.alpinelinux.org/$pkgver/data/edge/community/Components-x86_64.xml.gz
	$pkgname-repo-community-aarch64-$pkgver-edge.xml.gz::https://appstream.alpinelinux.org/$pkgver/data/edge/community/Components-aarch64.xml.gz
	$pkgname-icons-testing-64x64-$pkgver-edge.tar.gz::https://appstream.alpinelinux.org/$pkgver/data/edge/testing/icons-64x64.tar.gz
	$pkgname-icons-testing-128x128-$pkgver-edge.tar.gz::https://appstream.alpinelinux.org/$pkgver/data/edge/testing/icons-128x128.tar.gz
	$pkgname-repo-testing-x86_64-$pkgver-edge.xml.gz::https://appstream.alpinelinux.org/$pkgver/data/edge/testing/Components-x86_64.xml.gz
	$pkgname-repo-testing-aarch64-$pkgver-edge.xml.gz::https://appstream.alpinelinux.org/$pkgver/data/edge/testing/Components-aarch64.xml.gz
"
builddir="$srcdir/"

unpack() {
	:
}

package() {
	mkdir -p "$pkgdir"/usr/share/app-info/xmls

	for _repo in main community testing; do
		mkdir -p \
			"$pkgdir"/usr/share/app-info/icons/alpinelinux-edge-$_repo/64x64 \
			"$pkgdir"/usr/share/app-info/icons/alpinelinux-edge-$_repo/128x128

		tar xf "$srcdir"/$pkgname-icons-$_repo-64x64-$pkgver-edge.tar.gz -C "$pkgdir"/usr/share/app-info/icons/alpinelinux-edge-$_repo/64x64
		tar xf "$srcdir"/$pkgname-icons-$_repo-128x128-$pkgver-edge.tar.gz -C "$pkgdir"/usr/share/app-info/icons/alpinelinux-edge-$_repo/128x128
		cp "$srcdir"/$pkgname-repo-$_repo-$CARCH-$pkgver-edge.xml.gz "$pkgdir"/usr/share/app-info/xmls/$_repo.xml.gz
	done
}

sha512sums="61629fb06472b2fcf48af9965769834cb704b3f5897b63d9b55052512b8bf839066b2647b1923c14dd2ab07ac5de9270b167966ee4dd93a44f944a4f9d807a44  alpinelinux-appstream-data-icons-main-64x64-20200728-edge.tar.gz
61629fb06472b2fcf48af9965769834cb704b3f5897b63d9b55052512b8bf839066b2647b1923c14dd2ab07ac5de9270b167966ee4dd93a44f944a4f9d807a44  alpinelinux-appstream-data-icons-main-128x128-20200728-edge.tar.gz
a5a3e1fc36fa76e41fd189c373bf0a82143b0f138f83f334d56be6431e43e8865d4b35e3c6687b1eeebc8570f9d356f2c39bac10245ebd2cc2125e59ccaa43fb  alpinelinux-appstream-data-repo-main-x86_64-20200728-edge.xml.gz
05a3ad62c857838c3aab75e1e14646103315c0b81326d5381a3c40d6b88ff9acf5d786babc3419a2a2a491fe75bb9d62ccb35e40c3bcb9d42eec99e5b0c405a9  alpinelinux-appstream-data-repo-main-aarch64-20200728-edge.xml.gz
61629fb06472b2fcf48af9965769834cb704b3f5897b63d9b55052512b8bf839066b2647b1923c14dd2ab07ac5de9270b167966ee4dd93a44f944a4f9d807a44  alpinelinux-appstream-data-icons-community-64x64-20200728-edge.tar.gz
61629fb06472b2fcf48af9965769834cb704b3f5897b63d9b55052512b8bf839066b2647b1923c14dd2ab07ac5de9270b167966ee4dd93a44f944a4f9d807a44  alpinelinux-appstream-data-icons-community-128x128-20200728-edge.tar.gz
21e1167bc4872c03b92be5f9b15f6a16f6a890c4de910619b176b41faef6d4f47315d4fc424c6d055ff6b55642f3a020048b573b1225bc00827ba7a2adcddfd6  alpinelinux-appstream-data-repo-community-x86_64-20200728-edge.xml.gz
3d7ec17fc9a0643336fa0569b2033f4d9b0fc2daca3ac5616c683a7409ce9c9b22fb43ddb446f276636acaf03ef4917f16b9468befa27ed5365f307d58b0d813  alpinelinux-appstream-data-repo-community-aarch64-20200728-edge.xml.gz
61629fb06472b2fcf48af9965769834cb704b3f5897b63d9b55052512b8bf839066b2647b1923c14dd2ab07ac5de9270b167966ee4dd93a44f944a4f9d807a44  alpinelinux-appstream-data-icons-testing-64x64-20200728-edge.tar.gz
61629fb06472b2fcf48af9965769834cb704b3f5897b63d9b55052512b8bf839066b2647b1923c14dd2ab07ac5de9270b167966ee4dd93a44f944a4f9d807a44  alpinelinux-appstream-data-icons-testing-128x128-20200728-edge.tar.gz
827c80ad09397d5b5d4fa72a97f41d21809f0b63ed4b61935a3aff71c8af21a7d53ced7d8c403b3081c219709a269459d8301703c8558abffe6f88c6db88b4fc  alpinelinux-appstream-data-repo-testing-x86_64-20200728-edge.xml.gz
aacd0888e3420fa469cda42bf2a8965aab1aa91fd2a70ae582d1bd00e261a565804484ad75818650f838fa1a2900258274c78a99db22c1d5fff131e32e7e3e1c  alpinelinux-appstream-data-repo-testing-aarch64-20200728-edge.xml.gz"
